using System;
using System.Windows.Forms;
using Preparation;

namespace Tester.GuiActions.Actions.Impl
{
    public class VersionsAction : BaseAction
    {
        public override bool Visible
        {
            get
            {
                return TesterMultyDocument.Instance == null || 
                       TesterMultyDocument.Instance.Suspended == TesterMultyDocument.SuspendStates.Stopped;
            }
        }

        public override void MainAction(object sender, EventArgs e)
        {
            Versions verDlg = new Versions();
            verDlg.setController(CodegenVersionsController.Instance.clone());
            DialogResult res = verDlg.ShowDialog();
            if (res == DialogResult.OK)
            {
                CodegenVersionsController.Instance = verDlg.controller;
                CodegenVersionsController.Instance.dump();
            }
            else
            {
                //just do nothing; 
            }
        }

    }
}
